package net.kangyee.eventmanager.commands;

import org.bukkit.entity.Player;

import net.kangyee.eventmanager.EventManager;
import net.kangyee.eventmanager.util.MessageManager;

public class CmdToggle extends EventManagerCommand {
	
	private EventManager plugin;
	
	public CmdToggle(EventManager plugin){
		this.plugin = plugin;
	}

	public void onCommand(Player player, String[] args){
        	if(args[1].equalsIgnoreCase("on")){
        		plugin.setEventRegState(true);
        		MessageManager.sendNormalMessage(player, "当前状态:&a允许报名");
        		return;
        	} else if(args[1].equalsIgnoreCase("off")){
        		plugin.setEventRegState(false);
        		MessageManager.sendNormalMessage(player, "当前状态:&c禁止报名");
        		return;
        	} else {
        		MessageManager.sendNormalMessage(player, "请填写一个正确的参数,on:允许报名,off:禁止报名");
        	}
			return;
	}

	public String getCmdName(){
		return "toggle";
	}

	public String getArgs(){
		return "<on/off>";
	}
	
	public int getMaxArgs(){
		return 2;
	}

	public int getMinArgs(){
		return 2;
	}

	public String getPermission(){
		return "eventmanager.admin." + getCmdName();
	}

	public boolean getStateRequire(){
		return true;
	}
	
	public boolean getRegPCRequire() {
		return false;
	}
}
